from .config import LogConfig
from .handlers import register_request_logging


def setup_logging(app, **kwargs):
    """初始化日志并注册到 Flask 应用"""
    # 配置 Loguru
    log_config = LogConfig(app, **kwargs).setup()

    # 注册请求日志钩子
    register_request_logging(app)

    return log_config
